import React from 'react';
import Home from './components/Home/Home';
import Category from './components/Category';
import Cart from './components/Cart/Cart'
import User from './components/User'
import Item from './components/Cart/Item'
import {Route,NavLink,Switch,Redirect} from 'react-router-dom'
import Serach from './components/Serach';
var NotFound=()=>{
  return <div>404 页面没找到</div>
}
function App() {
  return (
    <div className="App">
        <NavLink to="/home">首页</NavLink>
        <NavLink to="/category">分类</NavLink>
        <NavLink to="/cart">购物车</NavLink>
        <NavLink to="/User">用户列表</NavLink>
        <Switch>
        <Route path="/home" component={Home} />
        <Route path="/category" component={Category} />
        <Route path="/cart" component={Cart} />
        <Route path="/user" component={User} />
        <Route path="/Item/:type" component={Item} />

        <Route path="/serach" component={Serach} /> 
        <Redirect from="/" to="/home" exact />
        <Route component={NotFound} />
        </Switch>
    </div>
  );
}

export default App;
